
AppDir=CurrentDir()


makesvmtrain(AppDir+"/c2/train", "train.svm")
makesvmtrain(AppDir+"/c2/test", "test.svm")

End



Function makesvmtrain(in:String, out:String)
  Local o:TStream=WriteFile(out)


  Local f:String[]=LoadDir(in)


  Local count:Int=1

  For Local i:String=EachIn f
    If count Mod 10=0 Then Print count+" / "+f.length
    count=count+1


    Local posneg:String=i[0..3]

    i=in+"/"+i

    Local file:TStream=ReadFile(i)


    Local str:String
    If posneg="pos"
      str="+1 "
    ElseIf posneg="neg"
      str="-1 "
    EndIf

    For Local j:Int=1 To 1000
      str=str+j+":"+ReadByte(file)+" "
    Next

    str=str[0..str.length-1]
'Print "///"+str

    WriteLine(o, str)


    CloseFile(file)
  Next


  CloseFile(o)
End Function



